package com.common.www.repository.tabulation;

import org.springframework.boot.base.jpa.repository.support.ExtendedRepository;
import com.common.www.bean.entity.tabulation.InnerBidBaseTabulation;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface InnerBidBaseTabulationRepository extends ExtendedRepository<InnerBidBaseTabulation, Long> {

    /**
     * 按项目查询
     * @param flag
     * @param projectId
     * @return
     */
    List<InnerBidBaseTabulation> findByFlagAndProjectId(Integer flag,Long projectId);

    /**
     * 按项目、标底类型查询
     * @param flag
     * @param projectId
     * @param type
     * @return
     */
    List<InnerBidBaseTabulation> findByFlagAndProjectIdAndBidType(Integer flag,Long projectId,Integer type);

    /**
     * 按项目、标底类型、分类查询
     * @param flag
     * @param projectId
     * @param type
     * @return
     */
    List<InnerBidBaseTabulation> findByFlagAndProjectIdAndBidTypeAndFenLei(Integer flag,Long projectId,Integer type,Integer fenLei);

    /**
     * 按项目删除
     * @param projectId
     * @param type
     * @return
     */
    @Modifying
    @Transactional
    int deleteByProjectIdAndBidType(Long projectId,Integer type);
}
